﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace Public.MvvmBase
{
    public class DataConvertMode : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if(value is int)
            {
                var view = (int)value;
                switch (view)
                {
                    case 0: return "Free";
                    case 1: return "Busy";
                }
            }
            return "Error";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var view = value.ToString();
            switch (view)
            {
                case "Free": return 0;
                case "Busy": return 1;
            }
            return "-1";
        }
    }
}
